package com.maple.phoneward.entity;

import com.maple.phoneward.constants.Constants;

/**
 * Contacts.java
 * 
 * @author: YaJian Qiu
 * @Time 2013-3-20 下午2:39:56<br>
 *       本类描述: 联系人
 */
public class Contacts {

	/**
	 * 联系人ID,从手机联系人数据中获取
	 */
	private Long contactId;
	/**
	 * 联系人的显示名称
	 */
	private String displayName;

	/**
	 * 联系人的号码
	 */
	private String number;

	/**
	 * 联系人的类型<br>
	 * Contacts.TYPE_PHONE 来自手机<br>
	 * Contacts.TYPE_SIM 来自SIM卡<br>
	 * Contacts.TYPE_UNKNOW 未知
	 */
	private String type;

	/**
	 * 号码类型编码
	 */
	private Integer typeCode;

	public Long getContactId() {
		return contactId;
	}

	public void setContactId(Long contactId) {
		this.contactId = contactId;
	}

	public String getDisplayName() {
		return displayName;
	}

	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Integer getTypeCode() {
		return typeCode;
	}

	public void setTypeCode(Integer typeCode) {
		this.typeCode = typeCode;
	}

	/** ================= */

	/**
	 * @param numType
	 * @return 号码类型
	 */
	public final static String getType(String numType) {
		if (numType != null && !"".equals(numType)) {
			if (numType.contains("sim")) {
				return Constants.TYPE_SIM;
			} else {
				return Constants.TYPE_PHONE;
			}
		}
		return Constants.TYPE_UNKNOW;
	}

	/**
	 * @param numType
	 * @return 号码类型编码
	 */
	public final static Integer getTypeCode(String numType) {
		if (numType != null && !"".equals(numType)) {
			if (numType.contains("sim")) {
				return Constants.TYPE_SIM_CODE;
			} else {
				return Constants.TYPE_PHONE_CODE;
			}
		}
		return Constants.TYPE_UNKNOW_CODE;
	}
}
